package com.validator;

import com.vo.AddressVo;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import java.util.Objects;

public class AddressValidator implements Validator {



    @Override
    public boolean supports(Class<?> clazz) {
        return AddressVo.class.isAssignableFrom(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
        ValidationUtils.rejectIfEmpty(errors,"city","城市不能为空");
        ValidationUtils.rejectIfEmpty(errors,"phone","电话号码不能为空");


    }
}
